home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / python2.4 / setobject.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-18  |  1.0 KB  |  42 lines

  1.  
  2. /* Set object interface */
  3.  
  4. #ifndef Py_SETOBJECT_H
  5. #define Py_SETOBJECT_H
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9.  
  10. /*
  11. This data structure is shared by set and frozenset objects.
  12. */
  13.  
  14. typedef struct {
  15.     PyObject_HEAD
  16.     PyObject *data;
  17.     long hash;    /* only used by frozenset objects */
  18.     PyObject *weakreflist; /* List of weak references */
  19.  
  20.     /* Invariants:
  21.      *     data is a dictionary whose values are all True.
  22.      *     data points to the same dict for the whole life of the set.
  23.      * For frozensets only:
  24.      *     data is immutable.
  25.      *     hash is the hash of the frozenset or -1 if not computed yet.
  26.      */
  27. } PySetObject;
  28.  
  29. PyAPI_DATA(PyTypeObject) PySet_Type;
  30. PyAPI_DATA(PyTypeObject) PyFrozenSet_Type;
  31.  
  32. #define PyFrozenSet_CheckExact(ob) ((ob)->ob_type == &PyFrozenSet_Type)
  33. #define PyAnySet_Check(ob) \
  34.     ((ob)->ob_type == &PySet_Type || (ob)->ob_type == &PyFrozenSet_Type || \
  35.       PyType_IsSubtype((ob)->ob_type, &PySet_Type) || \
  36.       PyType_IsSubtype((ob)->ob_type, &PyFrozenSet_Type))
  37.  
  38. #ifdef __cplusplus
  39. }
  40. #endif
  41. #endif /* !Py_SETOBJECT_H */
  42.